
import java.sql.Date;
import java.util.ArrayList;
import java.util.List;

import javax.xml.bind.annotation.XmlRootElement;

@XmlRootElement
public class DBMovie {
	private String id;
	private String title;
	private Person director;
	private Date date;
	private List<Person> actors;
	private List<MovieType> movieTypes;
	private String thumbnailURL; // 32x32
	private String playbillURL;
	private String trailerURL;

	public DBMovie() {
		title = "";
		id = "";
		date = null;
		thumbnailURL = "";
		director = new Person("", "");
		actors = new ArrayList<Person>();
		movieTypes = new ArrayList<MovieType>();
		playbillURL = "";
		trailerURL = "";
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public Person getDirector() {
		return director;
	}

	public void setDirector(Person director) {
		this.director = director;
	}

	public Date getDate() {
		return date;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	public List<Person> getActors() {
		return actors;
	}

	public void setActors(List<Person> actors) {
		this.actors = actors;
	}

	public List<MovieType> getMovieTypes() {
		return movieTypes;
	}

	public void setMovieTypes(List<MovieType> movieTypes) {
		this.movieTypes = movieTypes;
	}

	public String getThumbnailURL() {
		return thumbnailURL;
	}

	public void setThumbnailURL(String thumbnailURL) {
		this.thumbnailURL = thumbnailURL;
	}

	public String getPlaybillURL() {
		return playbillURL;
	}

	public void setPlaybillURL(String playbillURL) {
		this.playbillURL = playbillURL;
	}

	public String getTrailerURL() {
		return trailerURL;
	}

	public void setTrailerURL(String trailerURL) {
		this.trailerURL = trailerURL;
	}

	public String toString(){
		StringBuilder sb = new StringBuilder();
		sb.append("titolo: ");
		sb.append(title);
		sb.append("\n");
		
		sb.append("data: ");
		sb.append(date);
		sb.append("\n");
		
		sb.append("thumb: ");
		sb.append(thumbnailURL);
		sb.append("\n");
		
		sb.append("play: ");
		sb.append(playbillURL);
		sb.append("\n");
		
		sb.append("trailer: ");
		sb.append(trailerURL);
		sb.append("\n");
		
		sb.append("director: ");
		sb.append(director);
		sb.append("\n");
		sb.append("actors: ");
		for(Person a : actors){
			sb.append(a);
			sb.append(", ");
		}
		sb.append("\n");
		
		sb.append("genres: ");
		for(MovieType m : movieTypes){
			sb.append(m.getKey());
			sb.append(", ");
		}
		sb.append("\n");
		return sb.toString();
	}
	

}
